package com.cc.blog.admin.convert;

import com.cc.blog.admin.domain.vo.FindWikiPageListRspVO;
import com.cc.blog.admin.model.WikiDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * 知识库转换类
 * @Author cc
 * @Date 2025/1/10 15:41
 */
@Mapper
public interface WikiConvert {

    /**
     * 初始化 convert 实例
     */
    WikiConvert INSTANCE = Mappers.getMapper(WikiConvert.class);

    /**
     * WikiDO -> FindWikiPageListRspVO
     * @param bean
     * @return
     */
    @Mapping(target = "isTop", expression = "java(bean.getWeight() > 0)")
    FindWikiPageListRspVO convertDO2VO(WikiDO bean);
}
